/**
 * 统计页面业务统计住院js
 * @author lh
 * 2016-01-15
 *
 */
//日期格式按月份显示
/**
 * 门诊数据表格属性配置
 */
$('#bih_inHospital_monthDate').val(new Date().Format('yyyy-MM'));
//根据月份和区域查询住院信息
	function businessInHospital_query(){
		$('#businessInHospital_Grid').datagrid({
			url:'s/inhospital/table',
			method:'post',
			queryParams:{
				month:$('#bih_inHospital_monthDate').val(),
				province:$("#bih_province").combobox('getText') == '全国' ? null: $("#bih_province").combobox('getText'),
				city:$("#bih_city").combobox('getText') == '全省' ? null: $("#bih_city").combobox('getText'),
				dist:$("#bih_district").combobox('getText') == '全市' ? null: $("#bih_district").combobox('getText')
			},
			loadFilter:orange.systemPage.selfLoadFilter
		});
	}
	$('#businessInHospital_Grid').datagrid({ 
	    singleSelect:true,
	    rownumbers:true,
	    columns:[[ 
	        {field:'guid',hidden:true},
	        {field:'orgName',title:'中医馆名称',width:'25%',sortable:true,halign:'center',formatter:bih_checkDetail},
	        {field:'receiver',title:'正规出院人次',width:'25%',sortable:true,halign:'center'}, 
	        {field:'status',title:'死亡出院人次',width:'25%',sortable:true,halign:'center'},
	        {field:'messageType',title:'欠费出院人次',width:'23%',sortable:true,halign:'center'}
	    ]],
	    pagination:true,
	    sortable:true,
	    sortName: 'type',
	    sortOrder: 'asc'
	});
	//grid link
	function bih_checkDetail(value, row, index){
		if(value==null){
			return null;
		}else{
			return '<a href="#"  onclick="tcmReloadOrCreate(\''+row.guid+'\',\''+row.orgName+'\')">'+value+'</a>';	
		}
	};
	
	//省级数据
	var clearData=[];//清空数据
	var pData=[{'id':1,'text':'全国'},{'id':2,'text':'北京市'},{'id':3,'text':'天津市'},{'id':4,'text':'河北省'}];
	$("#bih_province").combobox({
		data:pData,   
	    valueField:'id',   
	    textField:'text',
	    onLoadSuccess:function(data){
	    },
	    onSelect:function(node){
	    	if(node.id==1){
	    		$("#bih_city").combobox({data:clearData});
	    		$("#bih_district").combobox({data:clearData});
	    	}else{
	    		bih_city();//$("#bih_city + .combo").show();
	    	}
	    }
	});
	var cData=[{'id':1,'text':'全省'},{'id':2,'text':'西市'},{'id':3,'text':'东市'},{'id':4,'text':'北市'}];
	$("#bih_city").combobox({
		valueField:'id',   
		textField:'text',
		onLoadSuccess:function(data){
			
		},
		onSelect:function(node){
			if(node.id==1){
				$("#bih_district").combobox({data:clearData});
			}else{
				bih_district();//$("#bih_district + .combo").show();
			}
		} 
	});
	var tData=[{'id':1,'text':'全市'},{'id':2,'text':'西区'},{'id':3,'text':'东区'},{'id':4,'text':'北区'}];
	$("#bih_district").combobox({
		valueField:'id',   
		textField:'text' ,
		onLoadSuccess:function(data){
		}
	});
	
	
	function bih_city(){
		//市级数据
		$("#bih_city").combobox({data:cData});
	}
	
	function bih_district(){
		//区域数据
		$("#bih_district").combobox({data:tData});
	}
